<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>购物车</title>
    <link rel="stylesheet" href="../css/common.css" />
    <link rel="stylesheet" href="../css/cart_list.css" />
    <script type="text/javascript" src="../js/underscore.js"></script>
    <script type="text/javascript" src="../js/template.js"></script>
    <script type="text/javascript" src="../js/jQuery.min.js"></script>
    <script type="text/javascript" src="../js/common.js"></script>
    <script type="text/javascript" src="../js/cart_list.js"></script>

    <script id="template_cart" type="text/html">
        <%for(var i = 0; i < list.length; i++) {%>
        <tr>
            <td><%:=list[i].type%></td>
            <td><%:=list[i].name%></td>
            <td><%:=list[i].price%></td>
            <td><%:=list[i].unit%></td>
            <td>
                <div class="show-num">
                    <button id=sub<%:=list[i].barcode%> onclick="subOneItemToCart()">➖</button>
                    <p id=num<%:=list[i].barcode%>><%:=list[i].count%></p>
                    <button id=add<%:=list[i].barcode%> onclick="addIOnetemToCart()">➕</button>
                </div>

            </td>
            <td id=subtotal<%:=list[i].barcode%>><%:=list[i].subtotal%></td>
            <!--<td><button id=<%:=list[i].barcode%> onclick="addItemToCart()">加入购物车</button></td>-->
        </tr>
        <%}%>
    </script>

</head>
<body>
<div class="nav">
    <ul>
        <li><a href="home.html">Let's Go</a></li>
        <li><a href="home.html">主页</a></li>
        <li><a href="shopping_list.html">商品列表</a></li>
        <li>
            <a class="cart" href="#">
                <img src="../image/cart.png" />
                <p id="cart_num">购物车(0)</p>
            </a>
        </li>
    </ul>
</div>

<div class="content">
    <p class="title">购物清单</p>
    <div class="split-line"></div>
    <table border="1px">
        <thead>
        <th>分类</th>
        <th>名称</th>
        <th>单价(元)</th>
        <th>单位</th>
        <th>数量</th>
        <th>小计</th>
        </thead>
        <tbody id="cart_list_info">
        </tbody>
    </table>
    <div class="show-total">
        <p>总计：<span id="total">159元</span></p>
        <button class="pay-button" onclick="pay()">付款</button>
    </div>

</div>


</body>
</html>